package com.jeesite.modules.jydq.entity;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import lombok.Getter;
import lombok.Setter;

import java.util.List;
import java.util.Map;

/**
 * 商品信息表Entity
 * @author dong
 * @version 2025-03-20
 */
@Table(name="jydq_product", alias="a", label="商品信息表信息", columns={
		@Column(name="id", attrName="id", label="编号", isPK=true),
		@Column(name="category_id", attrName="categoryId", label="分类ID"),
		@Column(name="category_name", attrName="categoryName", label="商品分类"),
		@Column(name="name", attrName="name", label="商品名称", queryType=QueryType.LIKE),
		@Column(name="brand", attrName="brand", label="品牌名称"),
		@Column(name="model", attrName="model", label="型号规格"),
		@Column(name="specifications", attrName="specifications", label="详细参数"),
		@Column(name="image", attrName="image", label="图片"),
		@Column(name="market_price", attrName="marketPrice", label="市场价", isUpdateForce=true),
		@Column(name="create_by", attrName="createBy", label="创建者", isUpdate=false, isQuery=false),
		@Column(name="create_date", attrName="createDate", label="创建时间", isUpdate=false, isQuery=false),
		@Column(name="update_by", attrName="updateBy", label="更新者", isQuery=false),
		@Column(name="update_date", attrName="updateDate", label="更新时间", isQuery=false),
		@Column(name="remarks", attrName="remarks", label="备注", queryType=QueryType.LIKE),
	}, orderBy="a.update_date DESC"
)
public class JydqProduct extends DataEntity<JydqProduct> {
	
	private static final long serialVersionUID = 1L;
	private String categoryId;		// 分类ID
	private String categoryName;	// 分类名称
	private String name;		// 商品名称
	private String brand;		// 品牌名称
	private String model;		// 型号规格
	private String specifications;		// 详细参数
	private String image;		// 图片
	private Double marketPrice;		// 市场价
	// 非持久化字段
	@Getter
	@Setter
	private Map<String, List<JydqProductPrice>> prices; //各电商出价
	@Getter
	@Setter
	private List<Map<String, String>> specificationList; // 详细参数(集合)
	@Getter
	@Setter
	private List<Map<String, String>> characteristic; // 产品特点(集合)
	@Getter
	@Setter
	private String keyword; // 查询关键字
	@Getter
	@Setter
	private String userCode; // 查询收藏时的入参

	public JydqProduct() {
		this(null);
	}
	
	public JydqProduct(String id){
		super(id);
	}
	
	@NotBlank(message="分类ID不能为空")
	@Size(min=0, max=64, message="分类ID长度不能超过 64 个字符")
	public String getCategoryId() {
		return categoryId;
	}

	public void setCategoryId(String categoryId) {
		this.categoryId = categoryId;
	}

	@Size(min=0, max=128, message="分类名称长度不能超过 128 个字符")
	public String getCategoryName() {
		return categoryName;
	}

	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}
	
	@NotBlank(message="商品名称不能为空")
	@Size(min=0, max=255, message="商品名称长度不能超过 255 个字符")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	@NotBlank(message="品牌名称不能为空")
	@Size(min=0, max=128, message="品牌名称长度不能超过 128 个字符")
	public String getBrand() {
		return brand;
	}

	public void setBrand(String brand) {
		this.brand = brand;
	}
	
	@NotBlank(message="型号规格不能为空")
	@Size(min=0, max=128, message="型号规格长度不能超过 128 个字符")
	public String getModel() {
		return model;
	}

	public void setModel(String model) {
		this.model = model;
	}
	
	@NotBlank(message="详细参数不能为空")
	public String getSpecifications() {
		return specifications;
	}

	public void setSpecifications(String specifications) {
		this.specifications = specifications;
	}
	
	@Size(min=0, max=255, message="图片长度不能超过 255 个字符")
	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}
	
	public Double getMarketPrice() {
		return marketPrice;
	}

	public void setMarketPrice(Double marketPrice) {
		this.marketPrice = marketPrice;
	}
	
}